package com.pb.b2b.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.pb.b2b.common.exception.CustomException;
import com.pb.b2b.common.service.impl.BaseServiceImpl;
import com.pb.b2b.dao.CategoryLanguageDao;
import com.pb.b2b.model.Category;
import com.pb.b2b.model.CategoryLanguage;
import com.pb.b2b.service.CategoryLanguageService;

@Service
public class CategoryLanguageServiceImpl extends BaseServiceImpl implements CategoryLanguageService {

	@Autowired
	private CategoryLanguageDao categoryLanguageDAO;

	@Transactional
	public List<CategoryLanguage> getCategoryLanguages(Category category) {
		List<CategoryLanguage> list = null;
		try {
			list = categoryLanguageDAO.getCategoryLanguages(category);
		} catch (Exception e) {
			new CustomException(e, LanguageServiceImpl.class);
		}
		return list;
	}

	@Transactional
	public List<CategoryLanguage> getDefaultCategoryLanguages() {
		// try {
		// int i = 0 / 0;
		return categoryLanguageDAO.getDefaultCategoryLanguages();

		// } catch (Exception e) {
		// new GenericException("Oppss...System error, please visit it later"
		// + e, LanguageServiceImpl.class);
		// return null;
		// }
	}
}
